package com.tianji.learning.controller;


import com.rabbitmq.client.Return;
import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.QuestionFormDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.query.QuestionPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.QuestionVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.checkerframework.framework.qual.HasQualifierParameter;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 管理端互动提问的问题表 前端控制器
 * </p>
 *
 * @author huanghui
 * @since 2023-07-25
 */
@RestController
@RequestMapping("/admin/questions")
@Api(tags = "管理端互动问题相关接口")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService questionService;

    /** @author ZXX-挚爱
    * @Description 管理端问题分页查询
    * @Dete 16:35 2023/7/27
    * @Param [query]
    * @return com.tianji.common.domain.dto.PageDTO<com.tianji.learning.domain.vo.QuestionAdminVO>
    **/

    @GetMapping("/page")
    @ApiOperation("管理端问题分页查询")
    public PageDTO<QuestionAdminVO> queryAdminQuestionPage(QuestionAdminPageQuery query){
        return questionService.queryAdminQuestionPage(query);
    }

    @GetMapping("/{id}")
    @ApiOperation("管理端根据id查询互动问题")
    public QuestionAdminVO queryQuestionByIdAdmin(@PathVariable("id") Long id ){
        return questionService.queryQuestionByIdAdmin(id);
    }

    @ApiOperation("隐藏或显示问题")
    @PutMapping("/{id}/hidden/{hidden}")
    public void hiddenQuestion(
            @ApiParam(value = "问题id", example = "1") @PathVariable("id") Long id,
            @ApiParam(value = "是否隐藏，true/false", example = "true") @PathVariable("hidden") Boolean hidden
    ){
        questionService.hiddenQuestion(id, hidden);
    }

}
